import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

// 课程类
class Course {
    private String courseId;
    private int credit;
    private int startTime;
    private int endTime;
    private String teacher;
    private String assessment;

    // 构造方法
    public Course(String courseId, int credit, int startTime, int endTime, String teacher, String assessment) {
        this.courseId = courseId;
        this.credit = credit;
        this.startTime = startTime;
        this.endTime = endTime;
        this.teacher = teacher;
        this.assessment = assessment;
    }
    // 获取课程号（供外部访问）
    public String getCourseId() {
        return courseId;
    }
    // 重写toString方法，用于打印课程信息
    @Override
    public String toString() {
        return String.format("课程号：%s，学分：%d，上课时间：%d，下课时间：%d，教师：%s，考核方式：%s",
                courseId, credit, startTime, endTime, teacher, assessment);
    }
}

// 学生类
class Student {
    private String name;
    private String studentId;
    private int courseNum = 3; // 固定选修3门课程
    private List<String> selectedCourses = new ArrayList<>(); // 存储选中的课程号

    // 构造方法
    public Student(String name, String studentId) {
        this.name = name;
        this.studentId = studentId;
    }

    // 获取选课数量
    public int getCourseNum() {
        return courseNum;
    }
    // 添加选中的课程号
    public void addSelectedCourse(String courseId) {
        selectedCourses.add(courseId);
    }
    // 获取学生姓名
    public String getName() {
        return name;
    }
    // 获取学号
    public String getStudentId() {
        return studentId;
    }

    // 获取选中的课程列表
    public List<String> getSelectedCourses() {
        return selectedCourses;
    }
}

public class Main {
    public static void main(String[] args) {
        // 创建课程列表
        List<Course> courses = new ArrayList<>();
        courses.add(new Course("001", 1, 7, 8, "Joyce", "assignment"));
        courses.add(new Course("002", 1, 8, 9, "Joyce", "assignment"));
        courses.add(new Course("003", 1, 12, 15, "Joyce", "assignment"));
        courses.add(new Course("004", 1, 18, 19, "Joyce", "assignment"));

        // 创建学生对象（姓名：小李，学号：24551119016）
        Student studentA = new Student("小李", "24551119016");

        // 显示可选课程
        System.out.println("可以选修的课程：");
        for (Course course : courses) {
            System.out.println(course);
        }

        // 学生输入选课信息
        Scanner scanner = new Scanner(System.in);
        System.out.println("请逐个输入选中的课程号（共3门）：");
        for (int i = 0; i < studentA.getCourseNum(); i++) {
            System.out.printf("请输入第%d门课程号：", i + 1);
            String courseId = scanner.next();
            studentA.addSelectedCourse(courseId);
        }
        scanner.close();

        // 打印选课结果
        System.out.printf("%s（学号：%s）的选课结果（课程号）：%s%n",
                studentA.getName(),
                studentA.getStudentId(),
                studentA.getSelectedCourses());
    }
}